﻿using KinonekoSoftware.CodariaDB.Documents.DataParts.Modules.RVE;

namespace KinonekoSoftware.CodariaDB.Documents.DataParts.Modules
{
    public sealed class Primitive_Option : ObservableObject
    {
        private string _name;
        private string _value;
        public  string Id { get; init; }
        
        public string Value
        {
            get => _value;
            set => SetValue(ref _value, value);
        }

        public string Name
        {
            get => _name;
            set => SetValue(ref _name, value);
        }
    }

    public sealed class Element_Option : ModuleElement, IMainVisualRowElement, IMetadataSupport, IHybridModuleBlock
    {
        public string ValueID  { get; set; }
        public string Metadata { get; set; }


        public override ModuleElement Clone() => new Element_Option
        {
            Id          = Id,
            Title       = Title,
            Description = Description,
            ValueID     = ValueID,
            Index       = Index,
            Metadata    = Metadata,
            Items       = Items.Select(x => new Primitive_Option { Id = x.Id, Value = x.Value, Name = x.Name }).ToList(),
        };

        IHybridModuleBlock IHybridModuleBlock.Clone() => (IHybridModuleBlock)Clone();
        IMainVisualRowElement IMainVisualRowElement.Clone() => (IMainVisualRowElement)Clone();

        public required List<Primitive_Option> Items { get; init; }
    }
}